import store from "../store/idnex.js";
import cryptoJs from "../utils/encryptDES.js";
import {
	requestkey
} from "./requestkey.js";

function getInfo() {
	let encrypted = ""
	encrypted = cryptoJs.encryptMD5(uni.getAccountInfoSync().miniProgram.appId)
	uni.getSystemInfo({
		success: function(res) {
			console.log(res.osName, "系统")
			let baseinfo = {
				userid: "",
				ap: "wifi",
				deviceid: "",
				ua: res.model,
				sid: "",
				version: res.system,
				osid: res.osName == 'ios' ? "wxios" : "weixin",
				df: 'smallapp',
				lg: "zh_hans",
				appId: store.state.appid,
				sha1: encrypted,
				apiVersion: "2",
				deductGold:true,
				newFormat:true
			};
			uni.setStorageSync("baseinfo", baseinfo); //设置缓存
			uni.setStorageSync("OS", res.osName);
			requestkey();
		},
	});
}
export {
	getInfo
};